export default {
	data() {
		return {
			hasAuthorityToSeeParams: { //访问他人课表的参数
				Authority: "",
				no: ""
			},
			browsingHistory: { //添加浏览记录的参数
				no: ""
			},
		}
	},
	methods: {
		async toHimCourse(item) {
			uni.showLoading({
				title: '加载中..',
				mask: true
			});
			let header = new Object()
			header.Authority = uni.getStorageSync("Authority");
			this.hasAuthorityToSeeParams.Authority = header.Authority;
			this.hasAuthorityToSeeParams.no = item.no;
			this.browsingHistory.no = item.no;
			let miTaIsHaiZhu;
			if (item.collegeId == 13 || item.collegeId == 4 || item.collegeId == 11) {
				miTaIsHaiZhu = true
			} else {
				miTaIsHaiZhu = false
			}
			let res = await getApp().UniRequest("/mita/authority/hasAuthorityToSee", "Get", this
				.hasAuthorityToSeeParams,header);
			// console.log(res)
			if (res.code === 20008) {
				uni.showToast({
					title: '对方设置权限，无法访问',
					icon: 'none',
					duration: 3000
				});
				uni.hideLoading()
			}
			if (res.code === 20000) {
				// console.log('111');
				// let data = await getApp().UniRequest("/mita/authority/browsingHistory", "PUT", this
				// 	.browsingHistory,
				// 	header);
				// if (data.code === 20000) {
				// 	// console.log('添加浏览记录成功');
				// } else {
				// 	// console.log('添加浏览记录失败')
				// }
				uni.navigateTo({
					url: '/page_miTa/miTaCourse/miTaCourse?Authority=' + res.data.Authority +
						'&miTaIsHaiZhu=' + miTaIsHaiZhu + '&name=' + item.name + '&no=' + item.no
				});
				uni.hideLoading()
			}
		},
	}
}